package com.aioething.iot.utils;

import java.util.Arrays;

public class StringUtils {
    public static String string(byte[] bytes) {
        int end = -1;
        for (int i = 0; i < bytes.length; i ++) {
            if (bytes[i] == 0) {
                end = i;
            }
        }
        return end == -1 ? new String(bytes) : new String(Arrays.copyOfRange(bytes, 0, end));
    }
}
